﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MicropleSoft.WmsServiceLibrary;
using MicropleSoft.WmsServiceLibrary.BusinessInterfaces;
using MicropleSoft.WmsServiceLibrary.Domain;
using MicropleSoft.WmsServiceLibrary.Unity;

namespace MicropleSoft.WmsService.DbSchema
{
    public class TableSchemaModifier : ITableSchemaModifier
    {

        public string ExcuteCreateTable(WmsServiceLibrary.Domain.IItemClass itemClass, List<WmsServiceLibrary.Domain.IItemTemplate> itemTemplates)
        {
            throw new NotImplementedException();
        }

        public string ExcuteAddColumn(WmsServiceLibrary.Domain.IItemTemplate itemTemplate)
        {
            throw new NotImplementedException();
        }

        public string ExcuteAlterColumn(WmsServiceLibrary.Domain.IItemTemplate itemTemplate)
        {
            throw new NotImplementedException();
        }

        public string ExcuteDropColumn(WmsServiceLibrary.Domain.IItemTemplate itemTemplate)
        {
            throw new NotImplementedException();
        }

        public void SaveItemClassAndItemTemplates(ItemClass itemClass, List<ItemTemplate> itemTemplates)
        {
            //1，保存主从表，如果是新建，则创建表
            //2，如果结构有修改，则修改对应的表
            //3，其他校验事项
            //4，不管表头是否有改动，表体可能会有增删改的动作

            if (itemClass.DomainObjectState == DomainEntityState.Added)
            {

            }
            else if (itemClass.DomainObjectState == DomainEntityState.Updated)
            {
                
            }
            else if (itemClass.DomainObjectState == DomainEntityState.Deleted)
            {

            }
            else//表头什么都没改
            {
                
            }
        }
    }
}
